import spring from "@/res/spring.js";
const base_url = '/user/';
//地址凭借
function http(url){
    return base_url+url
}
//登录
function userLogin(param={}) {
    return spring({
        url: http('login'),
        method: 'post',
        data: param
    })
}
//退出登录
function outLogin() {
    return spring({
        url: http('outLogin'),
        method: 'delete',
    })
}

//注册
function register(param) {
    return spring({
        url: http('register'),
        method: 'post',
        data: param
    })
}

//用户注销 /user/closeUser
function closeUser(){
    return spring({
        url: http('closeUser'),
        method: 'delete'
    })
}

//发送验证码 /user/send
function getSend(){
    return spring({
        url: http('send'),
        method: 'get'
    })
}

//验证码登录 /user/smslogin
function smslogin() {
    return spring({
        url: http('send')
    })
}

//根据id获取用户详细信息
function getUserByUsername(){
    return spring({
        url: "/userCard/getUserCardByUuid",
        method: 'POST',
        headers: {'Content-Type':'multipart/form-data'}
    })
}

// 获取用户信息
function getUserInfo() {
    return spring({
        url: "/userCard/getUser",
        method: 'POST',
        headers: {'Content-Type': 'multipart/form-data'}
    })
}
    // 获取已完成的课程
function getFinishClass(){
    return spring({
        url: "/classLinter/getFinishClass",
        method: 'POST',
        headers: {'Content-Type':'multipart/form-data'}
    })
}

// 修改用户卡片信息
function updateUserCard(param){
    return spring({
        url: "/userCard/updateUserCard",
        method: 'POST',
        data: param,
        headers: {'Content-Type':'multipart/form-data'}
    })
}
export {
    userLogin,register,
    outLogin,closeUser,
    smslogin,getSend,
    getUserByUsername,getFinishClass,
    updateUserCard,getUserInfo
}
